package com.aspose.cells;

import java.util.HashMap;

class zgl implements zaft {
   private Cells a;
   private RowCollection b;
   private zfv c;
   private FindOptions d;
   private zaia e;
   private boolean f;
   private boolean g;
   private double h;
   private boolean i;
   private HashMap j;
   private zbvx k;
   private zfv l;
   private zp m;
   private int n;

   zgl(Cells var1, Object var2, FindOptions var3) {
      this.a = var1;
      this.b = var1.getRows();
      this.d = var3;
      this.c = new zfv();
      this.l = this.c;
      boolean var4 = false;
      boolean var5 = false;
      double var6 = 0.0D;
      if (var2 != null) {
         this.e = new zbpu(com.aspose.cells.b.a.zr.a(var2), var3);
         switch(zamo.a(var2.getClass())) {
         case 9:
            var4 = true;
            var6 = (double)(Integer)var2;
         case 10:
         case 11:
         case 12:
         case 13:
         case 15:
         case 17:
         default:
            break;
         case 14:
            var4 = true;
            var6 = (Double)var2;
            break;
         case 16:
            var5 = true;
            var6 = CellsHelper.getDoubleFromDateTime((DateTime)var2, var1.r().n().getSettings().getDate1904());
            break;
         case 18:
            if (var3.getConvertNumericData()) {
               zati var8 = zyc.a((String)var2, var1.r().n().getSettings().e());
               if (var8 != null) {
                  switch(var8.a()) {
                  case 1:
                     var5 = true;
                     var6 = CellsHelper.getDoubleFromDateTime((DateTime)var8.d(), var1.r().n().getSettings().getDate1904());
                     break;
                  case 4:
                     var4 = true;
                     var6 = (Double)var8.d();
                  }
               }
            }
         }
      } else {
         this.e = null;
      }

      this.f = var4;
      this.g = var5;
      this.h = var6;
      this.k = var1.r().B();
      this.i = var3.getLookInType() != 3 && var3.getStyle() != null;
      if (this.i) {
         if (var3.getStyle().e() == null) {
            var3.getStyle().a(var1.r());
         }

         this.j = new HashMap();
      }

   }

   private Cell a(zp var1, int var2, zfv var3, boolean var4) {
      return new Cell(new Row(this.a, this.b, var1, false), var2, var3, var4);
   }

   public boolean a(zp var1, int var2) {
      this.c.b = -1;
      if (this.i) {
         this.l = var1.a(var2, this.c, 3);
         if (!this.c(var1)) {
            return false;
         }

         if (this.e == null) {
            return true;
         }
      }

      zyi var3;
      String var4;
      switch(this.d.getLookInType()) {
      case 0:
         this.l = var1.c(var2, this.c);
         switch(this.l.c) {
         case 0:
            return false;
         case 5:
            var3 = (zyi)this.l.d;
            var4 = var3.k();
            if (var4 == null) {
               if (this.l == this.c && !this.i) {
                  this.l = var1.a(var2, this.c, 3);
               }

               var4 = this.a(var1, var2, this.l, this.l == this.c).t();
               if (var4 == null) {
                  return false;
               }
            }

            return this.e.a(var4);
         default:
            if (this.l == this.c && !this.i) {
               this.l = var1.a(var2, this.c, 3);
            }

            return this.b(var1);
         }
      case 1:
         this.l = var1.c(var2, this.c);
         if (this.l.c == 0) {
            return false;
         }

         if (this.l == this.c && !this.i) {
            this.l = var1.a(var2, this.c, 3);
         }

         return this.b(var1);
      case 2:
         switch(var1.h(var2)) {
         case 0:
         case 5:
            return false;
         default:
            this.l = var1.a(var2, this.c, 7);
            return this.b(var1);
         }
      case 3:
         Comment var5 = this.a.h().getComments().get(var1.h(), var1.a(var2));
         if (var5 == null) {
            return false;
         }

         return this.e.a(var5.getNote());
      case 4:
         if (var1.h(var2) == 5) {
            var3 = (zyi)var1.i(var2);
            var4 = var3.k();
            if (var4 == null) {
               if (!this.i) {
                  this.l = var1.a(var2, this.c, 3);
               }

               if (this.l == this.c) {
                  this.l.c = 5;
                  this.l.d = var3;
               }

               var4 = this.a(var1, var2, this.l, this.l == this.c).t();
               if (var4 == null) {
                  return false;
               }
            }

            return this.e.a(var4);
         }

         return false;
      default:
         return false;
      }
   }

   private void a(zp var1) {
      if (this.c.b <= -1) {
         if (this.l.b > -1) {
            this.c.b = this.l.b;
         } else {
            if (var1 != this.m) {
               this.n = Row.e(var1);
               this.m = var1;
            }

            this.c.b = Cell.a((Cells)this.a, this.n, this.l.a);
         }
      }
   }

   private boolean b(zp var1) {
      if (this.l.c == 1 || this.l.c == 6) {
         double var2;
         if (this.f) {
            if (this.d.getLookAtType() == 3) {
               var2 = this.l.c == 1 ? (Double)this.l.d : zavz.a((Integer)this.l.d);
               return Math.abs(var2 - this.h) <= Double.MIN_VALUE;
            }

            return this.e.a(com.aspose.cells.b.a.zr.a(this.l.d));
         }

         if (this.g) {
            if (this.c.b < 0) {
               this.a(var1);
            }

            if (this.k.a(this.c.b).isDateTime()) {
               var2 = this.l.c == 1 ? (Double)this.l.d : zavz.a((Integer)this.l.d);
               return Math.abs(var2 - this.h) <= Double.MIN_VALUE;
            }

            return this.e.a(Cell.a(this.a, this.k.a(this.c.b), this.l));
         }

         if (this.d.a()) {
            return false;
         }
      }

      if (this.c.b < 0) {
         this.a(var1);
      }

      return this.e.a(Cell.a(this.a, this.k.a(this.c.b), this.l));
   }

   private boolean c(zp var1) {
      if (this.c.b < 0) {
         this.a(var1);
      }

      Object var2 = this.j.get(this.c.b);
      if (var2 != null) {
         return (Boolean)var2;
      } else {
         boolean var3 = this.a(this.k.a(this.c.b), this.d.getStyle());
         this.j.put(this.c.b, var3);
         return var3;
      }
   }

   private boolean a(Style var1, Style var2) {
      if (var2.isModified(11)) {
         if (var2.isModified(13) && !com.aspose.cells.b.a.zv.b(var1.getFont().getName(), var2.getFont().getName())) {
            return false;
         }

         if (var2.isModified(12) && var1.getFont().getSize() != var2.getFont().getSize()) {
            return false;
         }

         if (var2.isModified(16) && var1.getFont().b.c(var2.getFont().b)) {
            return false;
         }

         if (var2.isModified(18) && var1.getFont().isItalic() != var2.getFont().isItalic()) {
            return false;
         }

         if (var2.isModified(17) && var1.getFont().g() != var2.getFont().g()) {
            return false;
         }

         if (var2.isModified(19) && var1.getFont().getUnderline() != var2.getFont().getUnderline()) {
            return false;
         }

         if (var2.isModified(23) && var1.getFont().f() != var2.getFont().f()) {
            return false;
         }

         if (var2.isModified(20) && var1.getFont().isStrikeout() != var2.getFont().isStrikeout()) {
            return false;
         }
      }

      if (var2.isModified(1)) {
         if (var2.isModified(2) && !var1.getBorders().getByBorderType(1).equals(var2.getBorders().getByBorderType(1))) {
            return false;
         }

         if (var2.isModified(3) && !var1.getBorders().getByBorderType(2).equals(var2.getBorders().getByBorderType(2))) {
            return false;
         }

         if (var2.isModified(4) && !var1.getBorders().getByBorderType(4).equals(var2.getBorders().getByBorderType(4))) {
            return false;
         }

         if (var2.isModified(5) && !var1.getBorders().getByBorderType(8).equals(var2.getBorders().getByBorderType(8))) {
            return false;
         }

         if (var2.isModified(10) && !var1.getBorders().getByBorderType(32).equals(var2.getBorders().getByBorderType(32))) {
            return false;
         }

         if (var2.isModified(9) && !var1.getBorders().getByBorderType(16).equals(var2.getBorders().getByBorderType(16))) {
            return false;
         }
      }

      if (var2.isModified(32)) {
         if (var2.isModified(33) && var1.getPattern() != var2.getPattern()) {
            return false;
         }

         if (var2.isModified(34) && var1.b.c(var2.b)) {
            return false;
         }

         if (var2.isModified(35) && var1.a.c(var2.a)) {
            return false;
         }
      }

      if (var2.isGradient() && var1.b.c(var2.b)) {
         return false;
      } else {
         if (var2.isModified(25)) {
            if (var1.c != var2.c) {
               return false;
            }

            if (var1.b.c(var2.b)) {
               return false;
            }

            if (var1.a.c(var2.a)) {
               return false;
            }
         }

         if (var2.isModified(26) && var1.getVerticalAlignment() != var2.getVerticalAlignment()) {
            return false;
         } else if (var2.isModified(28) && var1.getRotationAngle() != var2.getRotationAngle()) {
            return false;
         } else if (var2.isModified(27) && var1.getIndentLevel() != var2.getIndentLevel()) {
            return false;
         } else {
            if (var2.isModified(24)) {
               if (var1.getNumber() != var2.getNumber()) {
                  return false;
               }

               if (!com.aspose.cells.b.a.zv.b(var1.getCustom(), var2.getCustom())) {
                  return false;
               }
            }

            return !var2.isModified(29) || var1.isTextWrapped() == var2.isTextWrapped();
         }
      }
   }
}
